package com.todo.sight.application.backend.controller;

import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.BizResponse;
import com.todo.sight.application.backend.service.SightPoiBackendService;
import com.todo.sight.application.iface.backend.SightPoiBackendIface;
import com.todo.sight.application.iface.backend.request.*;
import com.todo.sight.application.iface.backend.response.QuerySightPoiByConditionResp;
import com.todo.sight.application.iface.backend.response.QuerySightPoiDetailResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/5/16 13:57
 * @description
 */
@RestController
@RequestMapping("/bd/poi")
@Tag(name = "景点poi后台处理类", description = "景点poi后台处理类")
public class SightPoiBackendController implements SightPoiBackendIface {

    @Resource
    private SightPoiBackendService sightPoiBackendService;


    @Override
    @Operation(summary = "根据主键查询景点POI详情")
    @PostMapping("/querySightPoiById")
    public BizResponse<QuerySightPoiDetailResp> querySightPoiById(@RequestBody QuerySightPoiByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightPoiBackendService.querySightPoiById(req);
    }

    @Override
    @Operation(summary = "多条件查询景点PIO列表")
    @PostMapping("/querySightPoiByCondition")
    public BizPageResponse<QuerySightPoiByConditionResp> querySightPoiByCondition(@RequestBody QuerySightPoiByConditionReq req) {
        if (req == null) {
            return BizPageResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizPageResponse.paramError("参数错误");
        }
        return sightPoiBackendService.querySightPoiByCondition(req);
    }

    @Override
    @Operation(summary = "新增POI详情信息")
    @PostMapping("/insertSightPoi")
    public BizResponse<Boolean> insertSightPoi(@RequestBody InsertSightPoiReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightPoiBackendService.insertSightPoi(req);
    }

    @Override
    @Operation(summary = "根据主键更新POI信息")
    @PostMapping("/updateSightPoiById")
    public BizResponse<Boolean> updateSightPoiById(@RequestBody UpdateSightPoiReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightPoiBackendService.updateSightPoiById(req);
    }

    @Override
    @Operation(summary = "删除POI信息")
    @PostMapping("/removeSightPoiById")
    public BizResponse<Boolean> removeSightPoiById(@RequestBody RemoveSightPoiByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightPoiBackendService.removeSightPoiById(req);
    }

    @Override
    @Operation(summary = "根据主键启禁用景点POI信息")
    @PostMapping("/enableSightPoiById")
    public BizResponse<Boolean> enableSightPoiById(@RequestBody EnableSightPoiByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightPoiBackendService.enableSightPoiById(req);
    }

    @Override
    @Operation(summary = "批量excel倒入")
    @PostMapping("/batchInsertByExcel")
    public BizResponse<Long> batchInsertByExcel(@RequestBody MultipartFile file) {
        return null;
    }
}
